const vscode = require("vscode");
const fs = require("fs");

/**
 * 插件被激活时触发，所有代码的总入口
 * @param {vscode.ExtensionContext} context
 */
exports.activate = function(context) {
    // Use the console to output diagnostic information (console.log) and errors (console.error)
    // This line of code will only be executed once when your extension is activated
    console.log('Congratulations, your extension "Q" is now active!');

    // 校验按键精灵程序路径
    let configuration = vscode.workspace.getConfiguration().get("Ajjl.Grogram.Path");
    if (!fs.existsSync(configuration)) {
        vscode.window.showErrorMessage("按键精灵运行程序所在路径有误，请在 设置>扩展>按键精灵.Q 中进行设置");
        return;
    }

    // 注册命令
    require("./hover")(context); // 悬停提示
    require("./jump-to-definition")(context); // 跳转到定义
    require("./completion")(context); // 自动补全
}

/**
 * 插件被释放时触发
 */
exports.deactivate = function() { console.log('Your extension "Q" is now deactivate!'); }